package com.fertshop.gui.listener;

import java.awt.Dimension;

import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;

import com.fertshop.gui.MainPanel;

public class AddShopMenuListener implements MenuListener{

	private JDesktopPane desktop=null;
	
	
	public AddShopMenuListener(JDesktopPane desktop){
		this.desktop=desktop;		
	}
	
	@Override
	public void menuCanceled(MenuEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void menuDeselected(MenuEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void menuSelected(MenuEvent arg0) {		
		JInternalFrame addShopIf=new JInternalFrame("Add Shop");
		
		MainPanel mainPanel=new MainPanel();
		mainPanel.getUpdateButton().setEnabled(false);
		mainPanel.setPreferredSize(new Dimension(600,600));
		JScrollPane scroll=new JScrollPane(mainPanel,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
											ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
		scroll.setPreferredSize(new Dimension(400,400));
		addShopIf.setContentPane(scroll);
		desktop.add(addShopIf);		
		addShopIf.setClosable(true);
		addShopIf.setMaximizable(true);
		addShopIf.setResizable(true);
		addShopIf.setIconifiable(true); 
		try { 
			addShopIf.setSelected(true); 
	 	} catch (java.beans.PropertyVetoException e2) { 
	 	  } 
		addShopIf.setSize(500, 500);
		addShopIf.setVisible(true);
		
	}
	
	
	

}